<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>打印出库单</title>
		<link rel="stylesheet" type="text/css" href="../../../Themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../../../Themes/icon.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/demo.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/common.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/print.css">
		<script type="text/javascript" src="../../../JS/common.js"></script>
		<script type="text/javascript" src="../../../JS/jquery.min.js"></script>
		<script type="text/javascript" src="../../../JS/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="../../../JS/finance.js"></script>
	</head>

	<body>
		<div id="printContent"></div>

	</body>
	<script type="text/javascript" src="../../../JS/LogisticsShareFunction/PrintShareFunction.js"></script>
	<script type="text/javascript">
		id = getID();
		$(document).ready(function(){
			loadRemote();
		});
		
		function loadRemote() {
			$.ajax({
				type: "get",
				url: RemoteLinkAddress + "/logistics/warehouseout/findbyids.do?IDS=" + id,
				dataType: "json",
				success: function(result) {
					CreateHTML(result);
				}
			});
		}
		function CreateHTML(_data) {
			var disPlaycontent = "";
			var content = "";
			var content_indx = 0;
			var tmpID = "";
			var tmpPrice = "";
			var tmpSum = 0;
			var tmpName = "";
			for(var i = 0; i < _data.length; i++) {
				var rowdata = _data[i].rows;
				var totalSum = 0;
				for(var j = 0; j < rowdata.length; j++) {
					tmpPrice = rowdata[j].UNIT_PRICE;
					tmpSum = parseFloat(rowdata[j].UNIT_PRICE) * parseFloat(rowdata[j].AMOUNT);
					totalSum=totalSum+tmpSum;
					tmpName = rowdata[j].TRADE_NAME;
				}
				_data[i].LUMP_SUM = totalSum.toFixed(2);
				var content = "<div class=\"div_print_info_portait PageNext\"><h1 align=\"center\">绵阳市高水农副产品批发有限公司配送中心</h1><h1 align=\"center\">出库单</h1><form id=\"ff\" method=\"post\" style=\"width:95%;\"><table cellspacing=\"4\" style=\"margin-top: 10px;margin-left: 0px;margin-bottom: 10px;\"><tr><th>出库单编号</th><td></td><td><input type=\"text\" name=\"ORDER_NO\" value='" + _data[i].ORDER_NO + "' class=\"print_text_style\" /></td><th>销售单编号</th><td></td><td><input type=\"text\" name=\"SALESORDER_ID\" value='" + _data[i].SALESORDER_NO + "' class=\"print_text_style\" /></td></tr></table><table class=\"altrowstable printtable\" style=\"text-align: left;\"><tr><th width=\"15%\">配送单位</th><td width=\"35%\"><input style=\"width: 100%;\" type=\"text\" name=\"CUSTOMER_NAME\" value = '" + _data[i].CUSTOMER_NAME + "' class=\"print_text_style\" /></td><th width=\"15%\">配送时间</th><td width=\"35%\"><input style=\"width: 100%\" type=\"text\" value = '" + _data[i].DISTRIBUTION_DATE + "' name=\"DISTRIBUTION_DATE\" class=\"print_text_style\" /></td></tr><tr><th>用户组</th><td colspan=\"3\"><input style=\"width: 100%\" type=\"text\" value = '" + _data[i].CUSTOMER_TYPE + "' name=\"CUSTOMER_TYPE\" class=\"print_text_style\" /></td></tr></table><table id=\"OrderInforTable\" class=\"altrowstable printtable\" style=\"margin-top: 0px;\"><tr><th><div>内部商品名称</div></th><th><div>内部商品类型</div></th><th><div>单位</div></th><th><div>单价</div></th><th><div>销售数量</div></th><th><div>出库数量</div></th><th><div>出库总价</div></th></tr></table></table><table class=\"altrowstable printtable\" style=\"margin-top: 0px;\"><tr><th width='36%'> 人民币金额合计（小写） </th><td width='64%'> <input class=\"print_text_style\" value = '" + _data[i].LUMP_SUM + "' id=\"sumxx\"> </input></td></tr><tr><th> 人民币金额合计（大写） </th><td class=\"dx\"> <input class=\"print_text_style\" value = '" + changeMoneyToChinese(_data[i].LUMP_SUM) + "' id=\"sumdx\"> </input></td></tr></table><div><div style=\"float: left;margin-left: 10px;\"> 负责人： <span> </span></div></div></form></div>";
				$("#printContent").append(content);
				content_indx = content_indx + 1;
				$("#OrderInforTable").attr("id", "OrderInforTable" + content_indx);
				var newTd = new Array();
				var rowdata = _data[i].rows;
				var s = document.getElementById("OrderInforTable" + content_indx);
				for(var j = 0; j < rowdata.length; j++) {
					tmpPrice = rowdata[j].UNIT_PRICE;
					tmpSum = parseFloat(rowdata[j].UNIT_PRICE) * parseFloat(rowdata[j].AMOUNT);
					tmpSum = tmpSum.toFixed(2);
					totalSum = totalSum + parseFloat(tmpSum);
					tmpName = rowdata[j].INTERNAL_NAME;
					var newTr = s.insertRow();

					newTd[0] = newTr.insertCell()
					if(tmpName != undefined)
						newTd[0].innerText = tmpName;

					newTd[1] = newTr.insertCell();
					if(rowdata[j].INTERNAL_TYPE != undefined)
						newTd[1].innerText = rowdata[j].INTERNAL_TYPE;
					
					newTd[2] = newTr.insertCell();
					if(rowdata[j].UNIT_NAME != undefined)
						newTd[2].innerText = rowdata[j].UNIT_NAME;
					
					newTd[3] = newTr.insertCell();
					if(rowdata[j].AMOUNT != undefined)
						newTd[3].innerText = rowdata[j].AMOUNT;
						
					newTd[4] = newTr.insertCell();
					if(tmpPrice != undefined)
						newTd[4].innerText = tmpPrice;

					newTd[5] = newTr.insertCell();
					if(rowdata[j].WAREHOUSEOUT_AMOUNT != undefined)
						newTd[5].innerText = rowdata[j].WAREHOUSEOUT_AMOUNT;

					newTd[6] = newTr.insertCell();
					if(rowdata[j].WAREHOUSEOUT_SUM != undefined) {
						newTd[6].innerText = rowdata[j].WAREHOUSEOUT_SUM;
					}
				}
			}
		}
	</script>

</html>